<template>
  <el-dialog
    title="拒绝"
    :visible.sync="dialogVisible"
    :before-close="handleClose"
    :destroy-on-close="true"
    :close-on-click-modal="false"
    width="650px">
    <el-form
      :model="form"
      :rules="rule"
      ref="form"
      style="width: 560px"
      label-width="100px"
    >
      <el-form-item label="拒绝：" prop="content">
        <el-input placeholder="请输入拒绝理由" v-model="form.content"></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" style="display: flex;justify-content: center;">
      <el-button type="primary"
                 @click="cancel">取消
      </el-button>
      <el-button type="primary"
                 @click="submit">保存
      </el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'banner-edit',
  data () {
    return {
      dialogVisible: false,
      form: {
        content: ''
      },
      rule: {
        content: [
          { required: true, message: '请输入拒绝理由' }
        ]
      }
    }
  },
  methods: {
    handleClose (done) {
      done()
    },
    open () {
      this.dialogVisible = true
      this.form.content = ''
      return new Promise((resolve) => {
        this._resolve = resolve
      })
    },
    cancel () {
      this.close()
    },
    close () {
      this._resolve({ refresh: false, content: false })
      this.dialogVisible = false
    },
    submit () {
      this._resolve({ refresh: false, content: this.form.content })
      this.dialogVisible = false
    }
  }
}
</script>

<style scoped>

</style>
